const express = require("express");
const app = express();
const port =8080;

const users =[{uesrname:'admin',password:'password123'},{
    uesrname:'admin2',password:'1234'
}]
app.get("/login",(req,res)=>{
    let user = users.find(u=>u.username==req.query.uname&&u.password==req.query.upwd);
    console.log(uesr)
    if (user){
        res.json({code:200,msg:"登录成功"});
    }else{
        res.json({
            code:401,msg:"登录失败"
        });
    }
});
app.listen(port,()=>{
    console.log("监听端口"+port);
});